using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NCS.Library.Utilities;
using NCS.Module.Multimedia.Library.Gallery;
using NCS.Module.Multimedia.Library;
using NCS.Library;

namespace NCS.Module.Multimedia.Web.Gallery
{
    public partial class Detail : GalleryWebControl
    {
        protected int i = 1;
        protected int count = 0;
        protected int j = 0;
        protected int pic = 0;
        protected int check = 0;
        protected int sum = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            Gallery_AlbumInfo info = Gallery_AlbumController.GetAlbum(albumid);
            ltrcontent.Text = info.AlbumDetail;
            hplAlbum.Text = info.AlbumName;

            DataTable dtpic = PictureController.Picture_GetAllByAlbumIDAndVisible(albumid, 1);
            sum = dtpic.Rows.Count;

            rptPic.DataSource = dtpic;
            rptPic.DataBind();

            rptPixno.DataSource = dtpic;
            rptPixno.ItemDataBound += new RepeaterItemEventHandler(rptPixno_ItemDataBound);
            rptPixno.DataBind();

            hplreturn.NavigateUrl = BuildUrlByGallery();
        }

        void rptPixno_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                Label lbnumber = (Label)e.Item.FindControl("lbnumber");

                lbnumber.Text = i.ToString();
                i++;

            }
        }

        protected void rptPic_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                DataRowView currow = (DataRowView)e.Item.DataItem;
                Label lblDesc = (Label)e.Item.FindControl("lblDesc");

                if (ConvertUtility.ToString(currow["PicDetail"]) != String.Empty)
                {
                    lblDesc.Text = "<br> " + ConvertUtility.ToString(currow["PicDetail"]);
                }
                else
                {
                    lblDesc.Visible = false;
                }
               
            }
        }
       
    }
}